package com.wondertek.poms.dao.repo;

import com.wondertek.poms.dao.po.ContentFee;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author gzx
 */
@Repository
public interface IContentFeeDao extends JpaRepository<ContentFee, Long> {

	@Query(value = "select fee.TYPE,fee.POMS_ID,fee.PRICE,fee.ORDER_FLAG,fee.DISCOUNT,fee.SALE_CATEGORY, fee.CHANNEL_PACKAGE_ID " +
			"from CONTENT_FEE  fee where fee.POMS_ID in ?1 and fee.START_TIME <= ?2  and ?2 <= fee.END_TIME", nativeQuery = true)
	List<ContentFee> findAllByPomsId(List<Long> ids,  String nowTime);


	/** TODO
	 *@author gaozhengxing gaozhenghang@wondertek.com.cn
	 *@date 2021/1/8 18:21
	 *@param prdContId type=1:产品包id，type=2：节目id
	 *@param  type=1:产品包id，type=2：节目id
	 *@return  促销列表*/
	List<ContentFee> findByPomsIdAndType(Long prdContId, int type);

}
